class PhotoController < ApplicationController
	def check_price
		price = params[:price]
		# 还要检查有没有数字
		if price.empty? || !is_float(price)
			render :update do |page|
				page.replace_html 'price_message', "照片的价格必须输入，例如10.00"
				page['commit'].disabled = true
			end
		else
			render :update do |page|
				page['commit'].disabled = false
			end
		end
	end
	
	def is_float(value)
		begin
			Kernel.Float(value)
			return true
		rescue ArgumentError, TypeError
			return false
		end
	end
end